namespace ProduceBasicData.Api.DTO
{
    /// <summary>
    /// BOM树形结构DTO
    /// </summary>
    public class BOMTreeDTO
    {
        public int Id { get; set; }
        
        /// <summary>
        /// BOM编码
        /// </summary>
        public string BOMCode { get; set; }
        
        /// <summary>
        /// BOM名称
        /// </summary>
        public string BOMName { get; set; }
        
        /// <summary>
        /// BOM版本
        /// </summary>
        public string BomVersion { get; set; }
        
        /// <summary>
        /// BOM类型
        /// </summary>
        public string BomType { get; set; }
        
        /// <summary>
        /// BOM阶别
        /// </summary>
        public string BOMSteps { get; set; }
        
        /// <summary>
        /// BOM层级编码
        /// </summary>
        public int BOMLevel { get; set; }
        
        /// <summary>
        /// 工序外键
        /// </summary>
        public int ProcessId { get; set; }
        
        /// <summary>
        /// 工序编码
        /// </summary>
        public string ProcessCode { get; set; }
        
        /// <summary>
        /// 工序名称
        /// </summary>
        public string ProcessName { get; set; }
        
        /// <summary>
        /// BOM用量
        /// </summary>
        public string BOMDosage { get; set; }
        
        /// <summary>
        /// BOM描述
        /// </summary>
        public string BOMDesc { get; set; }
        
        /// <summary>
        /// 父级BOM ID
        /// </summary>
        public int? ParentBOMId { get; set; }
        
        /// <summary>
        /// 创建人
        /// </summary>
        public string CreateName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新人
        /// </summary>
        public string? UpdateName { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }
        
        /// <summary>
        /// 子级BOM列表
        /// </summary>
        public List<BOMTreeDTO> Children { get; set; } = new List<BOMTreeDTO>();
        
        /// <summary>
        /// 是否有子级
        /// </summary>
        public bool HasChildren => Children?.Any() == true;
        
        /// <summary>
        /// 是否展开
        /// </summary>
        public bool IsExpanded { get; set; } = false;
    }
}
